import sys
import uvicorn

from  iotutils.pyTerminal import  ter

if __name__ == "__main__":
    terCode = "ter_wx_01"
    if len(sys.argv)>1 :
        terCode = sys.argv[1]
    print('start terminal ' , terCode)
    ter.setSettings(terCode)
    ter.restart()

    port = ter.settings['localPort']
    uvicorn.run(
        "pyTerminal:app" ,
        host='0.0.0.0' ,
        port= port ,
        reload=False
    )